<template>
  <el-container style="height: 100%">
    <el-aside width="200px" style="">
      <!--<div style="width: 200px;height:60px">-->
      <!--  <el-image :src="src" fit="scale-down" style="height: 60px;width: 60px;margin: 0px;float: left"></el-image>-->
      <!--  <div style="height:60px ;width: 140px;float: right;margin-top: 10%">xAPI&#45行为分析系统</div>-->
      <!--</div>-->
      <el-menu :default-openeds="['1', '5']">
        <el-menu-item index="1-2-1" @click="goTo('/')">首页</el-menu-item>
        <el-menu-item index="1-2-1" @click="analyse">APP行为分析</el-menu-item>
        <el-menu-item index="1-3" @click="goTo('/searchTimes')">行为追踪</el-menu-item>
        <el-submenu index="3-2">
          <template slot="title">注册表</template>
          <el-menu-item index="3-2-1" @click="goTo('/verb')">Verb</el-menu-item>
          <el-menu-item index="3-2-2" @click="goTo('/activity')">Activity</el-menu-item>
        </el-submenu>

      </el-menu>
    </el-aside>
    <el-main>
      <router-view/>
    </el-main>
  </el-container>
</template>
<script>
  export default {
    name: 'AgentMain',
    data() {
      return {
        src: require('../../assets/headerlogo.png'),
        agent: JSON.parse(localStorage.getItem("agent"))
      }
    },
    methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
      goTo(path) {
        this.$router.replace(path);
      },
      analyse(){
        console.log(this.agent.agentOpenid)
        this.$axios
          .get('/api/app/show', {
            params:{adminOpenid: this.agent.agentOpenid}
          }).then(success=>{
          this.$router.push({path:'/app/analyse',query: {id:success.data.appId}})
        }).catch(fail=>{})
      }
    }
  }
</script>
